package com.wifi.a007;

import android.content.Context;
import android.os.Handler;
import android.service.carrier.CarrierService;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.Log;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.wifi.a007.wifiFragment.CustomActionWebView;
import com.wifi.a007.wifiFragment.HotInfo;


import com.wifi.a007.wifiFragment.wifiAdapter;


import java.util.List;

/**
 * Created by Administrator on 2017/7/1.
 */

public  class ViewName   {

    public static Context  mContext;

    ///activity

    public static Handler  mainHandler;
    ///




    ///localnet
    public static  Button button1;
    public static EditText time;
    public static EditText pingtype;
    public static EditText count;
    public static TextView machine;
    ////

    /////webFragment

    public static Button back;
    public static Button  screen;
    public static Button  autoLogin;
    public static Button  map;
    public static int screenStatus=1;
    public static CustomActionWebView webView;


    public static Button  listMenu;
    ////////////wifinet list

    public static TextView wifiConnectName;
    public static TextView wifiConnectInfo;
    public static SwipeRefreshLayout swipRefresh;
    public static  wifiAdapter adapter;
    public static List<HotInfo> wifiList;
    ////

    public static void init(int resource, View  view){

        switch (resource){
            case R.layout.activity_main:

                initMain(view);
                break;
            case R.layout.localnet_fragment_main_layout:

                initLocalNet(view);
                break;
            case R.layout.web_fragment_main_layout:

                initWebFragment(view);
                break;
            case R.layout.wifi_fragment_main_layout:

                initWifiNetFragment(view);
                break;



        }





    }
    public static void initMain(View view){




    }
    public static void initLocalNet(View view){






        button1=(Button)view.findViewById(R.id.button1);
        button1.setOnClickListener(ClickFunction.initClick());
        time=(EditText)view.findViewById(R.id.time);
        pingtype=(EditText)view.findViewById(R.id.pingtype);
        count=(EditText)view.findViewById(R.id.count);
        machine=(TextView)view.findViewById(R.id.machine);




    }


    public static void initWebFragment(View view){



        back=(Button)view.findViewById(R.id.back);
        screen=(Button)view.findViewById(R.id.screen);
        autoLogin=(Button)view.findViewById(R.id.autoLogin);
        map=(Button)view.findViewById(R.id.map);
        webView=(CustomActionWebView) view.findViewById(R.id.webView1);
        webView.init();

        mContext=view.getContext();

        back.setOnClickListener(ClickFunction.initClick());
        screen.setOnClickListener(ClickFunction.initClick());
        autoLogin.setOnClickListener(ClickFunction.initClick());
        map.setOnClickListener(ClickFunction.initClick());
    }


    public static void initWifiNetFragment(View view){

        wifiConnectName=(TextView)view.findViewById(R.id.wifiConnectName);
        wifiConnectInfo=(TextView)view.findViewById(R.id.wifiConnectInfo);
        swipRefresh    =(SwipeRefreshLayout)view.findViewById(R.id.swipe_refresh);
        swipRefresh.setColorSchemeResources(R.color.colorPrimary);
        swipRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {

             new Thread(new Runnable() {
                 @Override
                 public void run() {

                     ClickFunction.reFresh();
                 }
             }).start();




            }
        });



    }



}
